import packageJson from './package.json'

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: [
    '@nuxtjs/tailwindcss',
    '@formkit/auto-animate',
    '@vueuse/nuxt',
    '@element-plus/nuxt',
    '@pinia/nuxt',
    '@pinia-plugin-persistedstate/nuxt',
    '@vueuse/nuxt'
  ],
  app: {
    baseURL: '/app',
    head: {
      title: '破壳AI应用集',
      link: [
        { rel: 'icon', type: 'image/x-icon', href: '/app/icon.png' }
      ],
      meta: [{
        hid: 'keywords', name: 'keywords', content: '破壳AI,破壳AI应用集,AI,人工智能,gpt'
      }, {
        hid: 'description', name: 'description', content: '破壳AI应用集汇聚了各种基于破壳AI的实用应用，包括聊天机器人、文生图等'
      }
      ],
      script: [
        { src: '/iconfont/iconfont.js' }
      ],
      style: [
        {
          children: '.icon {width: 1em;height: 1em;vertical-align: -0.15em;fill: currentColor;overflow: hidden;}'
        }
      ]
    },
    rootId: packageJson.name
  },
  vite: {
    server: {
      proxy: {
        '/app/v1': {
          target: 'https://perkai.pushplus.plus',
          changeOrigin: true
        },
        '/app/ai/common': {
          target: 'https://perkai.pushplus.plus',
          changeOrigin: true,
          rewrite: path => path.replace(/^\/app\/ai\/common/, '/ai/common')
        }
      }
    }
  },
  piniaPersistedstate: {
    storage: 'localStorage'
  }
})
